package oo;

import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;

import javax.faces.model.SelectItem;

public class ComboBoxDemoBean {

	private Map<String, List<SelectItem>> selectItems = new Hashtable<String, List<SelectItem>>();


	private boolean disabled = false;
	private ComboBoxItem backgroundColorItem;
	private ComboBoxItem fontStyleItem,wydzial;

	public ComboBoxItem getWydzial() {
		System.out.println("a");
		return wydzial;
	}
	public void setWydzial(ComboBoxItem wydzial) {
		System.out.println("b");
		this.wydzial = wydzial;
	}
	public void metoda(){
		System.out.println("c");
	}
	public Map<String, List<SelectItem>> getSelectItems() {
		return selectItems;
	}
	

	public ComboBoxItem getBackgroundColorItem() {
		System.out.println("1");
		return backgroundColorItem;
	}

	public void setBackgroundColorItem(ComboBoxItem backgroundColorItem) {
		System.out.println("2");
		this.backgroundColorItem = backgroundColorItem;
	}
	
	public ComboBoxItem getFontStyleItem() {
		return fontStyleItem;
	}


	public void setFontStyleItem(ComboBoxItem fontStyleItem) {
		this.fontStyleItem = fontStyleItem;
	}	

	public ComboBoxDemoBean() {
		initSelectItems();
	}
	


	public boolean isDisabled() {
		return disabled;
	}

	public void setDisabled(boolean disabled) {
		this.disabled = disabled;
	}

	
	public void initSelectItems() {
		selectItems.clear();
		
		selectItems.put("Colors", generateColorSelectItems());
		/*selectItems.put("FontStyles", generateFontStylesSelectItems());
		selectItems.put("wydzialy", generatewydzialy());
		*/
		//selectItems.put("Colors", generateColorSelectItems());
		
	}
	public static ArrayList<SelectItem> generatewydzialy(){
		ArrayList<SelectItem> wydzialy = new ArrayList<SelectItem>();
		wydzialy.add(new SelectItem("wydzial1","cokolwiek"));
		wydzialy.add(new SelectItem("wydzial2","2cokolwiek"));
		return wydzialy; 
	}
	public static ArrayList<SelectItem> generateColorSelectItems() {
		ArrayList<SelectItem> arrayList = new ArrayList<SelectItem>();
		ComboBoxItem cboitem = null;
		
		cboitem = new ComboBoxItem();
		cboitem.setTranslate(true);						
		cboitem.setResValue("wydzial1");
		cboitem.setValue("cokolwiek");
		arrayList.add(new SelectItem(cboitem, cboitem.getTranslatedvalue()));
		
		cboitem = new ComboBoxItem();
		cboitem.setTranslate(true);						
		cboitem.setResValue("kolejny");
		cboitem.setValue("00FF00");
		arrayList.add(new SelectItem(cboitem, cboitem.getTranslatedvalue()));
		
		return arrayList;
		
	}
	
	public static ArrayList<SelectItem> generateFontStylesSelectItems() {
		ArrayList<SelectItem> arrayList = new ArrayList<SelectItem>();
		ComboBoxItem cboitem = null;
		
		cboitem = new ComboBoxItem();
		cboitem.setTranslate(true);						
		cboitem.setResValue("app.fontStyles.normal");
		cboitem.setValue("normal");
		arrayList.add(new SelectItem(cboitem, cboitem.getTranslatedvalue()));
		
		cboitem = new ComboBoxItem();
		cboitem.setTranslate(true);						
		cboitem.setResValue("app.fontStyles.italic");
		cboitem.setValue("italic");
		arrayList.add(new SelectItem(cboitem, cboitem.getTranslatedvalue()));
		
		
		return arrayList;
		
	}	
	
}
